import java.util.Scanner;

public class demo01 {
    //收件人列表
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            int n=sc.nextInt();
            sc.nextLine();
            for (int i = 0; i < n; i++) {
                String name=sc.nextLine();
                if(name.contains(",")||name.contains(" ")){
                    System.out.print("\""+name+"\"");
                }else{
                    System.out.print(name);
                }
                if(i==n-1){
                    System.out.println();
                }else{
                    System.out.println(", ");
                }
            }
        }
    }
}
